
function(create_version_h)
  execute_process(
    COMMAND hg parents --template {node|short}
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    OUTPUT_VARIABLE BUILD_VERSION
  )

  CONFIGURE_FILE(
    ${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
    ${CMAKE_CURRENT_BINARY_DIR}/version.h
  )
endfunction()

create_version_h()
